#!/usr/bin/python2.7
#coding=utf8
import sys

def test():
    from conf.globalconfiguration import Config
    print(Config.CONN)




def csvParse():
    pass

def testFormat():
    from database.oracle.conf import Dataformat
    oracle_format=Dataformat()
    print(oracle_format.transfer("ferf(10)"))
    
def getcsvpaths():
    from csvparse.getcsvfilesabspath import Csvfilepaths
    csvfiles=Csvfilepaths()
    files=csvfiles.getcsvfilepaths()
    return files
    #print(files)
    
def testsyspath():
    from database.oracle.databaseOracle import SqlAlchemy
    ssss=SqlAlchemy()
    session=ssss.dbsession()
    print(session)
#连接 oracle 数据库并生成表
def createTableOracle():
    from database.oracle.createoracletable import CreateTable
    from conf.globalconfiguration import Config
    config=Config()
    createtable=CreateTable()
    createtable.generatetable(config)
    
def firstmodel():
    #往sqlalchemy_oracle_sql.py 写 表头
    from conf.globalconfiguration import Config
    from database.sqlalchemy_oracle.conf import Dataformat
    dataformat=Dataformat()
    sqlfilepath=Config.SQLALCHEMY_ORACLESQLFILEPATH
    sqlfile=open(sqlfilepath,"a")
    sqlfile.write(dataformat.sqlalchemy_head)
    sqlfile.close()
    
    
    from database.comm import *
    files=getcsvpaths()
    for i in files:
        parsing(i)
        
def secondmodel():
    firstmodel()
    createTableOracle()
    
def test():
    while True:
        model=input("请选择模式：\n1）只生成sql-script \n2）生成SQL-script、连接oracle后进行建表\n3)退出\n")
        model=str(model)
        #print(type(model))
        #print(type("exit"))
        if model == "1":
            print("1")
            break
        elif model == "2":
            print("2")
            break
        elif model == "3":
            sys.exit(0)
        else:
            print("No such option")
    
if __name__ == "__main__":
    firstmodel()
    
    
    